﻿<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags"%>

<sec:authentication property="principal" var="currentPrincipal" scope="page" />

<%-- <div class="ihg-sidemenu ihg-theme-draft" style="display: inline;">
  <ul class="nav nav-stacked ihg-sidebar" role="tablist">
    <c:forEach var="menu" items="${secure.submenus}">
      <c:if test="${currentPrincipal.hasResource('submenus', menu.id)}">
        <li class="presentation" role="presentation">
          <a href="javascript:void(0);" class=""><span class="caret"></span>${menu.name}</a>
          <ul class="subnav list-unstyled">
            <c:forEach var="submenu" items="${menu.submenus}">
              <c:if test="${currentPrincipal.hasResource('submenus', submenu.id)}">
                <c:choose>
                  <c:when test="${not empty submenu.submenus}">
                    <li class="presentation" role="presentation">
                      <a href="javascript:void(0);" class=""><span class="caret"></span>${submenu.name}</a>
                      <ul class="subnav list-unstyled">
                        <c:forEach var="ssmenu" items="${submenu.submenus}">
                          <li class="${menuContext.shouldHighlight(ssmenu.id) ? 'active' : ''}">
                          	<c:choose>
                          		<c:when test="${not empty param.currentUrl}">
                            		<a href="${ctx.host}/${param.currentUrl}/${ssmenu.url}" title="${ssmenu.description}">${ssmenu.name}</a>
                          		</c:when>
                          		<c:otherwise>
                          			<a href="${ctx.host}/${ssmenu.url}" title="${ssmenu.description}">${ssmenu.name}</a>
                          		</c:otherwise>
                          	</c:choose>
                          </li>
                        </c:forEach>
                      </ul></li>
                  </c:when>
                  <c:otherwise>
                    <li class="${menuContext.shouldHighlight(submenu.id) ? 'active' : ''}">
                    	<c:choose>
                    		<c:when test="${not empty param.currentUrl}">
                    			<a href="${ctx.host}/${param.currentUrl}/${submenu.url}" title="${submenu.description}">${submenu.name}</a>
                    		</c:when>
                    		<c:otherwise>
                    			<a href="${ctx.host}/${submenu.url}" title="${submenu.description}">${submenu.name}</a>
                    		</c:otherwise>
                    	</c:choose>
                    </li>
                  </c:otherwise>
                </c:choose>
              </c:if>
            </c:forEach>
          </ul>
        </li>
      </c:if>
    </c:forEach>
  </ul>
</div> --%>

<div class="ihg-sidemenu ihg-theme-draft" style="display: inline;">
  <ul class="nav nav-stacked ihg-sidebar" role="tablist">
     <c:forEach var="menu" items="${secure.submenus[activeMenu]}">
     
        <c:if test="${currentPrincipal.hasResource('submenus', menu.id)}"> 

             <li class="presentation" role="presentation">
               <a href="javascript:void(0);" class="" ><span class="caret"></span>${menu.name}</a>
               <ul class="subnav list-unstyled">
               
                 <c:forEach var="submenu" items="${menu.submenus}">
                 
                    <c:if test="${currentPrincipal.hasResource('submenus', submenu.id)}"> 
                   
                       <c:choose>
                         <c:when test="${not empty submenu.submenus}">
                           <li class="presentation" role="presentation">
                             <a href="javascript:void(0);" class="" ><span class="caret"></span>${submenu.name}</a>
                             <ul class="subnav list-unstyled">
                               <c:forEach var="ssmenu" items="${submenu.submenus}">
                                 <li class="${menuContext.shouldHighlight(ssmenu.id) ? 'active' : ''}"><a href="${ctx.host}/${ssmenu.url}" title="${ssmenu.description}">${ssmenu.name}</a></li>
                               </c:forEach>                       
                             </ul>
                           </li>
                         </c:when>
                         <c:otherwise>
                           <li class="${menuContext.shouldHighlight(submenu.id) ? 'active' : ''}"><a href="${ctx.host}/${submenu.url}" title="${submenu.description}">${submenu.name}</a></li>  
                         </c:otherwise>
                       </c:choose>     
                   

                   </c:if> 

                             
                 </c:forEach>
                 
               </ul>
             </li>
             
        </c:if> 

         
    </c:forEach> 
  
  </ul>
</div>